home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / bbs / pad311.zip / FINDCHAR.MH < prev    next >
Text File  |  1996-08-21  |  869b  |  33 lines

  1. #ifndef __FINDCHAR_MH
  2. #define __FINDCHAR_MH
  3.  
  4. #ifndef __COUNTCHA_MH
  5. #include "countcha.mh"
  6. #endif
  7.  
  8. // Returns true if all the characters in the string "chars" can be found
  9. // in the string "theString". This is useful for checking user keys.
  10.  
  11. bool findAllChars (string: theString, string: chars) {
  12.   int: idx;
  13.   for (idx := 1; idx <= strlen (chars); idx := idx + 1) {
  14.     if (countChar (theString, chars [idx]) = 0)
  15.       return False;
  16.     };
  17.   return True;
  18.   }
  19.  
  20. // Returns true if any of the characters in the string "chars" can be found
  21. // in the string "theString". Again, this is useful for working with user keys.
  22.  
  23. bool findAnyChars (string: theString, string: chars) {
  24.   int: idx;
  25.   for (idx := 1; idx <= strlen (chars); idx := idx + 1) {
  26.     if (countChar (theString, chars [idx])) return True;
  27.     };
  28.   return False;
  29.   }
  30.  
  31. #endif
  32.  
  33.